# config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'jupiter'
set :repo_url, 'git@git.oschina.net:teddylee/jupiter.git'
set :rvm_ruby_version, '2.3.1'
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
set :branch, "master"
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, "/var/apps/#{fetch(:application)}"

# Default value for :scm is :git
#set :scm, :git

# Default value for :format is :pretty
#set :format, :pretty
set :scm, :git
set :deploy_via, :remote_cache
set :copy_exclude, %w(.git)
set :normalize_asset_timestamps, false
set :format, :pretty
set :log_level, :debug
# Default value for :log_level is :debug
#set :log_level, :debug

set :pty, true

# Default value for :pty is false
# set :pty, true
#puma common config
#set :puma_bind, "tcp://0.0.0.0:3062"
#set :puma_preload_app, true
#set :puma_prune_bundler, true
#set :puma_tag, fetch(:application)
#set :puma_worker_timeout, 60
#set :puma_init_active_record, true
#unicorn.rb 路径
set :unicorn_config_path, "#{fetch(:deploy_to)}/current/config/unicorn.rb"

set :keep_releases, 3

#set :linked_files, %w{config/database.yml config/secrets.yml}
# Default value for linked_dirs is []
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets public/assets public/house}

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      invoke 'unicorn:restart'
    end
  end

  task :spp do
    puts ssh_options
  end

  after :publishing, :restart
end